﻿// Decompiled with JetBrains decompiler
// Type: MCM.Internal.Extensions.PlatformFileHelperPCExtended
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using HarmonyLib.BUTR.Extensions;
using TaleWorlds.Library;

#nullable enable
namespace MCM.Internal.Extensions
{
  internal static class PlatformFileHelperPCExtended
  {
    private static PlatformFileHelperPCExtended.GetDirectoryFullPathDelegate? GetDirectoryFullPathMethod = AccessTools2.GetDelegate<PlatformFileHelperPCExtended.GetDirectoryFullPathDelegate>("TaleWorlds.Library.PlatformFileHelperPC:GetDirectoryFullPath");
    private static PlatformFileHelperPCExtended.GetPlatformFileHelperDelegate? GetPlatformFileHelper = AccessTools2.GetPropertyGetterDelegate<PlatformFileHelperPCExtended.GetPlatformFileHelperDelegate>("TaleWorlds.Library.Common:PlatformFileHelper");

    public static string? GetDirectoryFullPath(PlatformDirectoryPath directoryPath)
    {
      if (PlatformFileHelperPCExtended.GetPlatformFileHelper != null && PlatformFileHelperPCExtended.GetDirectoryFullPathMethod != null)
      {
        object instance = PlatformFileHelperPCExtended.GetPlatformFileHelper();
        if (instance != null)
          return PlatformFileHelperPCExtended.GetDirectoryFullPathMethod(instance, directoryPath);
      }
      return (string) null;
    }

    private delegate string GetDirectoryFullPathDelegate(
      object instance,
      PlatformDirectoryPath directoryPath);

    private delegate object GetPlatformFileHelperDelegate();
  }
}
